﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CCPnuts.Pack;

namespace CCPnuts.ISkyDiskFileSystem.Interfaces
{
    public interface I_SkyElementContainer : I_SkyElement
    {
        #region Essential Memebers

        #region Modify Methods

        /// <summary>
        /// upload a file to this container
        /// </summary>
        /// <param name="path"></param>
        I_Uploader UploadFile(string path);

        /// <summary>
        /// delete a element from this container
        /// </summary>
        /// <param name="element"></param>
        void Delete(I_SkyElement element);

        /// <summary>
        /// delete a file with the given name
        /// </summary>
        /// <param name="fileName"></param>
        void DeleteFile(string fileName);

        /// <summary>
        /// delete a directory with the given name
        /// </summary>
        /// <param name="dirName"></param>
        void DeleteDir(string dirName);

        /// <summary>
        /// create a dir
        /// </summary>
        /// <param name="dirName"></param>
        void CreateDir(string dirName);

        #endregion

        #region Properties

        /// <summary>
        /// get the collection of child
        /// </summary>
        I_SkyElementCollection Children { get; }

        #endregion

        #endregion

        #region Optional Members

        /// <summary>
        /// [Optional]Gets the target path
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        [Optional]
        I_SkyDirectory this[string path] { get; }

        /// <summary>
        /// [Optional]Gets the target file
        /// </summary>
        /// <param name="path"></param>
        /// <param name="fileName"></param>
        /// <returns></returns>
        [Optional]
        I_SkyFile this[string path, string fileName] { get; }

        /// <summary>
        /// [Optional]Gets the directory in its children by its name
        /// </summary>
        /// <param name="dirName"></param>
        /// <returns>directory; null if not found</returns>
        [Optional]
        I_SkyDirectory GetDir(string dirName);

        /// <summary>
        /// [Optional]Check if there is such a directory
        /// </summary>
        /// <param name="dirName"></param>
        /// <returns></returns>
        [Optional]
        bool HasDir(string dirName);

        /// <summary>
        /// [Optional]Gets the file in its children by its name
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns>file; null if not found</returns>
        [Optional]
        I_SkyFile GetFile(string fileName);

        /// <summary>
        /// [Optional]Check if there is such a file
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        [Optional]
        bool HasFile(string fileName);

        /// <summary>
        /// Upload a directory. This is a Optional method.
        /// </summary>
        /// <param name="dirpath"></param>
        /// <returns></returns>
        [Optional]
        bool UploadDirectory(string dirpath);

        #endregion
    }
}
